{if !$submit_ok}
	<h5 class="memberarea_caption">{$catname}</h5>
{/if}
<script language="javascript">
xajax_myFunction('{$reg_2_value}');
xajax_myFunction('{$reg_3_value}');
</script> 
<table border="0" cellspacing="1" width="100%">
<tr>
    <td width="100%" valign="top">


{if $errorMsg}
	<ol class="red">{$errorMsg}</ol>
{/if}


{if $submit_ok}

{if $await_validation}
<p>{$smarty.const.LA_VALIDATION_WAIT}</p>
{/if}


<h5 class="memberarea_caption">{$smarty.const.LA_CHOOSE}</h5>
<div style="clear:both;height:12px;"></div>
	
	{if $picture_upload_enable}
	<br />
	<a href='{$url_to_upload}?pic_ad_id={$ad_id}' class="thumb">
	<img src="{$url}/layout_images/new/images.gif" align="left" border="0" hspace="3" vspace="3" alt="{$smarty.const.LA_UPLOAD_VIDEO}" />
	</a>
	<a href='{$url_to_upload}?pic_ad_id={$ad_id}'>
	{$smarty.const.LA_I_WANT}</a>
	{/if}	
	
	{if $set_video_upload}
	<br /><br />
	<a href='{$url_to_upload_video}?video_ad_id={$ad_id}' class="thumb">
	<img src="{$url}/layout_images/new/film.gif" align="left" border="0" hspace="3" vspace="3" alt="{$smarty.const.LA_UPLOAD_VIDEO}" />
	</a>
	<a href='{$url_to_upload_video}?video_ad_id={$ad_id}'>
	{$smarty.const.LA_UPLOAD_VIDEO}</a>
	{/if}
	
	{if $set_doc_upload}
	<br /><br />
	<a href='{$url_to_upload_doc}?doc_ad_id={$ad_id}' class="thumb">
	<img src="{$url}/layout_images/new/doc.gif" align="left" border="0" hspace="3" vspace="3" alt="{$smarty.const.LA_UPLOAD_DOC}" />
	</a>
	<a href='{$url_to_upload_doc}?doc_ad_id={$ad_id}'>
	{$smarty.const.LA_UPLOAD_DOC}</a>
	{/if}
	
	<br /><br />
	<a href='index.php' class="thumb">
	<img src="{$url}/layout_images/new/home_icon.gif" align="left" border="0" hspace="3" vspace="3" alt="{$smarty.const.LA_RET}" />
	</a><a href='index.php'>{$smarty.const.LA_RET}</a>
    <br /><br />
    <a href='choose_cat.php' class="thumb">
	<img src="{$url}/layout_images/new/addad.gif" align="left" border="0" hspace="3" vspace="3" alt="{$smarty.const.LA_ADD_AN}" />
	</a>
    <a href='choose_cat.php'>{$smarty.const.LA_ADD_AN}</a>
    <br />

{/if}

{if $pay_out_of_credits}
	<h4>{$smarty.const.LA_OUT_OF_CREDITS}</h4>
	{$smarty.const.LA_CREDITS_WARNING} <br />
	{$smarty.const.LA_CREDITS_WARNING2}
	<br /><br />{$smarty.const.LA_VISIT_OUR} <a href="payment_options.php"><u>{$smarty.const.LA_PAID_MEMBERSHIP}</u></a> {$smarty.const.LA_FOR_MORE_INFO}<br /><br />
	
		
{/if}

{if $show_form}

{if $set_payments}
	<p style="background-color:white">
	{$smarty.const.LA_PAY_CREDITS_BAL} <b>{$pay_free_credits}</b> {$smarty.const.LA_PAY_CREDITS}<br />
	{$smarty.const.LA_PAY_COST} <b>{$pay_catcost}</b> {$smarty.const.LA_PAY_CREDITS}
	</p>
	<div style="clear:both;height:12px;"></div>
{/if}

<form method='post' action='{$phpself}' name="itemForm">
<input type='hidden' name='ad_id' value='{$ad_id}'>
<input type='hidden' name='update_rq' value='{$update_rq}'>
{if !$ad_id}
<input type='hidden' name='catid' value='{$catid}'>
{/if}


<table border="0" cellpadding="1" cellspacing="1" width="100%">

	<tr>
    <td width="30%" valign="top">{$smarty.const.TITLE} <span class="red">*</span></td>
    <td width="70%" valign="top">
	<input type="text" name="ad_title" size="39" maxlength="150" class="txt" value="{$ad_title}">
	</td>
  	</tr>

  	{if $set_region==1 && !$admin_region_options}
		<tr>
	    <td width="30%" valign="top">{$smarty.const.LA_REGION} <span class="red">*</span></td>
	    <td width="70%" valign="top">
		<select id="reg_1" name="reg_1" onChange='xajax_myFunction(reg_1.value)' class='regionselect'>
		{$reg_1_options}
		</select>
		
		<p><div id="DropDown2"></div></p>
		<p><div id="DropDown3"></div></p>
		
		</td>
	  	</tr>
  	{elseif $admin_region_options}
  		<tr>
	    <td width="30%" valign="top">{$smarty.const.LA_REGION} <span class="red">*</span></td>
	    <td width="70%" valign="top">
		<select id="admin_region_selected" name="admin_region_selected" class='regionselect'>
		{$admin_region_options}
		</select>
		</td>
	  	</tr>
  	
  	{/if}
    <tr>
    <td width="30%" valign="top">{$smarty.const.DESCRIPTION} <span class="red">*</span></td>
    <td width="70%" valign="top"><textarea rows="7" id="ad_description" name="ad_description" cols="45">{$ad_description}</textarea>

    </td>
  </tr>
  
  
{foreach item=e from=$extra_fields_array}

{if $e.q_catdescr}
	<tr><td colspan="2">
   		<b>{$e.q_catdescr}</b><hr style="color:black;" width="50%" align="left">
	</td></tr>
{/if}

<tr>
	<td valign="top">{$e.q_question} {if $e.q_mand}<span class="red">*</span>{/if}</td>
   	<td valign="top">
   	
   	{if $e.q_type=="t"}

   		<input type="text" name="e_{$e.q_field}" size="{$e.q_size}" value="{$e.q_value}" class="{$e.q_css_class}"/>

   	{elseif $e.q_type=="e"}

   		<input type="text" name="e_{$e.q_field}" size="{$e.q_size}" value="{$e.q_value}" class="{$e.q_css_class}" />
   	   		
   	{elseif $e.q_type=="p"}

   		<input type="text" name="e_{$e.q_field}" size="7" value="{$e.q_value|replace:".":$decimal}" class="{$e.cssClass}"/> {$set_currency_text}
   	
   	{elseif $e.q_type=="d"}

   		<textarea cols="{$e.q_size}" rows="{$e.q_size_2}" name="e_{$e.q_field}">{$e.q_value}</textarea>
   		
   	{elseif $e.q_type=="c"}
   		{foreach item=opt from=$e.options}
   		<input type="checkbox" name="e_{$e.q_field}[]" id="{$e.q_field}" value="{$opt.value}" {if $opt.selected_value} checked{/if}>
   			{if $opt.$lang} {$opt.$lang|escape}{else}{$opt.text|escape}{/if} <br />
   		{/foreach}

   	{elseif $e.q_type=="s"}
	   	<select name="e_{$e.q_field}" class="txt">
	   	{if $e.q_mand}
	   		<option value=''>--</option>
	   	{else}
	   		<option value='0'>{$smarty.const.LA_EMPTY}</option>
	   	{/if}	
   		{foreach item=opt from=$e.options}
   			<option value="{$opt.value}"{if $opt.selected_value} selected{/if}>{if $opt.$lang} {$opt.$lang|escape}{else}{$opt.text|escape}{/if}</option>
   		{/foreach}
   		</select>
   		
   	{elseif $e.q_type=="r"}
   		
   		{foreach item=opt from=$e.options}
   			<input type="radio" name="e_{$e.q_field}[]" id="{$e.q_field}" value="{$opt.value}" {if $opt.selected_value} checked{/if}>
   			{if $opt.$lang} {$opt.$lang|escape}{else}{$opt.text|escape}{/if} <br />
   		{/foreach}
   		
   		
   	{/if}
   	

   	
   </td>
</tr>

{/foreach} 
  
  
  
  
  
  {if $admin_area || $ad_id}

    <tr>
    <td width="30%" valign="top">{$smarty.const.LA_CHANGE}</td>
    <td width="70%" valign="top"><select name='catid' class="txt">
    {$cat_list}
   	</select>
    </td>
  </tr>
  
  {/if}
  

{if $set_expire_days_option==1 && !$ad_id}
  <tr>
  <td width="30%" valign="top">{$smarty.const.LA_RUNDAYS} <font color=red>*</font></td>
  <td width="70%" valign="top"><select name="expire_days" class="txt">
  {$expire_list}
  </select>
  </td>
  </tr>
  {/if}

  
<tr><td colspan="2">
<p><input type='submit' name='submit' class='button' value='{$smarty.const.SUBMIT_BUTTON}'></p>
</td>
</tr>
</table>
</form>
{/if}


</td></tr></table>


{literal}
<script type="text/javascript">
var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
jQuery(document).ready(setupAutocomplete);

function setupAutocomplete() {
	jQuery(".ef_marca_mt").autocomplete(months, {
		minChars: 0,
		max: 12,
		autoFill: true,
		selectFirst: true,
		mustMatch: false,
		/*matchContains: true,*/
		scrollHeight: 220,
		formatItem: function(data, i, total) {
			// don't show the current month in the list of values (for whatever reason)
			if ( data[0] == months[new Date().getMonth()] ) 
				return false;
			return data[0];
		}
	});
	
	var button = jQuery('<input type="button" value="*"  />');
	var elem = jQuery(".ef_marca_mt").get(0);
	
	jQuery(button).mouseup(function(){
		var event = jQuery.Event("keydown");
		event.keyCode = 40; //DOWN
		var aux = jQuery(elem).val();
		jQuery(elem).focus().val("").trigger(event).val(aux);
	});
	
	jQuery(button).insertAfter(".ef_marca_mt");

}
</script>
{/literal}

